package org.lex.game.sudoku.datatype;

public enum HintType {
	/**
	 * no hints are showing
	 */
	NONE,
	/**
	 * show hints for current selected cell
	 */
	CELL,
	/**
	 * show hints for all cells
	 */
	ALL;

	/**
	 * Unlike <code>Enum.valueOf(...)</code>, this method DO NOT throws any
	 * exception.
	 * 
	 * @param name
	 * @return
	 */
	public static HintType getByName(String name) {
		HintType result = NONE;
		if (null != name) {
			name = name.trim();
			for (HintType t : HintType.values()) {
				if (t.name().equalsIgnoreCase(name)) {
					result = t;
					break;
				}
			}
		}
		return result;
	}
}